home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
bsrc_250.zip
/
MAILOVLY.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-15
|
33KB
|
1,192 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software, Co. */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / Freely Available<tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
/* */
/* */
/* This module was written by Bob Hartman */
/* */
/* */
/* BinkleyTerm Mail Control Routines */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.250. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */
/* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */
/* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */
/* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */
/* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */
/* */
/* */
/* You can contact Bit Bucket Software Co. at any one of the following */
/* addresses: */
/* */
/* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */
/* P.O. Box 460398 AlterNet 7:491/0 */
/* Aurora, CO 80046 BBS-Net 86:2030/1 */
/* Internet f491.n343.z1.fidonet.org */
/* */
/* Please feel free to contact us at any time to share your comments about */
/* our software and/or licensing policies. */
/* */
/*--------------------------------------------------------------------------*/
/* Include this file before any other includes or defines! */
#include "includes.h"
char mail_stat (MAILP);
int xmit_install (MAILP, ADDRP);
MAILP xmit_find (MAILP, ADDRP);
long netsize (MAILP);
int any_mail (MAILP);
void do_xmit_line (char *, MAILP);
void xmit_sort (void);
char *numdisp (long);
#ifdef MILQ
static char *HoldFmtStr = "%16.16s %4.4s %5.5s %c";
static char *HoldNoSize = "%21.21s %5.5s %c";
#else
static char *HoldFmtStr = "%-16.16s %4.4s %5.5s %c";
static char *HoldNoSize = "%-21.21s %5.5s %c";
#endif
void xmit_sameplace ()
{
MAILP p, p1;
/* Find the guy we just gave mail to */
p = find_mail (&remote_addr);
remote_addr.Zone = remote_addr.Net = remote_addr.Node = remote_addr.Point = 0;
remote_addr.Domain = NULL;
if (p == NULL)
{
/* He is not there */
return;
}
/* Save our current pointer */
p1 = next_mail;
if (p != next_mail)
{
/* If it is not the one we just gave mail to, save ptr and delete */
next_mail = p;
xmit_delete ();
next_mail = p1;
}
else
{
/* It was the guy at the head of the list, so just delete him */
xmit_delete ();
}
/* If we came in with a null, leave with a null */
if (p1 == NULL)
next_mail = NULL;
return;
}
MAILP find_mail (ADDRP address)
{
MAILP p;
p = mail_top;
while (p != NULL)
{
if ((no_zones || (p->mail_addr.Zone == address->Zone)) &&
(p->mail_addr.Net == address->Net) &&
(p->mail_addr.Node == address->Node) &&
(p->mail_addr.Point == address->Point) &&
((p->mail_addr.Domain == address->Domain) ||
((p->mail_addr.Domain == my_addr.Domain) &&
(address->Domain == NULL))))
break;
p = p->next;
}
return (p);
}
int xmit_install (MAILP p, ADDRP addr)
{
MAILP p1, p2;
int rettype;
long sztemp;
p2 = find_mail (addr);
if (p2 == NULL)
{
/* We didn't find it in what we have already */
p1 = p;
p1->mail_addr = *addr;
rettype = 0;
}
else
{
/* We found it, so we have to make sure the higher level routine knows */
p1 = p2;
rettype = 1;
}
/*
* Get the size of the entry. If it's a FLO-type file,
* call netsize to find out how big the stuff contained in it
* actually is. If it's a packet, just take its size.
*
* Hold packets don't count.
*/
if (!no_size)
{
sztemp = 0L;
if (!strncmp (&(dta_str.name[10]), "LO", 2))
p1->mailsize += (sztemp = netsize (p1));
else
if (!strncmp (&(dta_str.name[10]), "UT", 2))
p1->mailsize += (sztemp = dta_str.size);
if (dta_str.name[9] != 'H')
p1->callsize += sztemp;
}
switch (dta_str.name[9])
{
case 'C': /* Crash */
p1->mailtypes |= MAIL_CRASH;
break;
case 'H': /* Hold */
p1->mailtypes |= MAIL_HOLD;
break;
case 'F': /* Normal */
case 'O':
p1->mailtypes |= MAIL_NORMAL;
break;
case 'D': /* Direct */
p1->mailtypes |= MAIL_DIRECT;
break;
case 'R': /* Request */
p1->mailtypes |= MAIL_REQUEST;
break;
}
if (!nodefind (&(p1->mail_addr), 0))
{
p1->mailtypes |= MAIL_UNKNOWN;
return (rettype);
}
/* Don't call for "HOLD" or "REQ" stuff. */
if ((dta_str.name[9] == 'H') || (dta_str.name[9] == 'R'))
{
return (rettype);
}
/* If there's no event, set mail to 'go' */
if (cur_event < 0)
{
p1->mailtypes &= ~MAIL_QSMALL;
p1->mailtypes |= MAIL_WILLGO;
return (rettype);
}
/* If it is a crash only event and we have crashmail, set it to go */
if (e_ptrs[cur_event].behavior & MAT_HIPRICM)
{
if ((dta_str.name[9] == 'C') && (newnodedes.NodeFlags & B_CM))
{
p1->mailtypes &= ~MAIL_QSMALL;
p1->mailtypes |= MAIL_WILLGO;
return (rettype);
}
}
/* If it is a crash only event and this wasn't crash, return */
if ((dta_str.name[9] != 'C') && (e_ptrs[cur_event].behavior & MAT_CM))
{
return (rettype);
}
/* Is this a local only event? */
if (e_ptrs[cur_event].behavior & MAT_LOCAL)
{
/*
* If this is supposed to be only local, then get out if it isn't
*/
if (e_ptrs[cur_event].node_cost >= 0)